#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include "QtGui"
#include "phonon/volumeslider.h"
#include "phonon/seekslider.h"
#include "playlist.h"
#include "player.h"
#include "queue.h"

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
	MainWindow();

private:
	PlayList playlist;
	Player player;
	QPoint mousePosition;
	QIcon musicListItemIcon;
	bool moving;

	void initialize();
    void setupMenu(QMenu *menu);
	void addFiles(QStringList pathList);
    void addDirectory(QString);
    void addSongToPlaylist(QString);
    void addSongToList(Song*);
	void updateMusicList();
	void updateMusicInfo();
	bool checkPlayList(bool showMessage = false);

    //ui objects
    QPushButton *playPauseButton;
    QPushButton *nextButton;
    QPushButton *previousButton;
    QPushButton *closeButton;
    QPushButton *minimizeButton;
    QPushButton *repeatButton;
    QLabel *musicInfo;
    QLabel *timeLabel;
    Phonon::SeekSlider *seekSlider;
    Phonon::VolumeSlider *volumeSlider;
    QListWidget *musicList;

private slots:
    void addFiles();
    void addDirectory();
    void playPause();
    void sortByTitle();
    void sortByArtist();
    void sortByAlbum();
	void previous();
	void next();
    void updateTime();
	void stateChanged(Phonon::State, Phonon::State);
    void onSongFinished();
    void save();
	void setRepeat(bool);
	void removeSelecteds();
	void removeAll();
	void itemDoubleClicked(QListWidgetItem*);
    void open();
	void songChanged();
    void exportPlaylistTo();

protected:
	void mousePressEvent(QMouseEvent *event);
	void mouseMoveEvent(QMouseEvent *event);
	void mouseReleaseEvent(QMouseEvent *event);

	void dropEvent(QDropEvent *event);
	void dragEnterEvent(QDragEnterEvent *event);
};

#endif // MAINWINDOW_H
